define(['knockout','mAjax','util'], function (ko,MAjax,Util) {
    function Password(params) {
        var  scope = this;

        this.fields=[
            {name:'loginName',alias:'用户名'},
            {name:'name',alias:'姓名'},
            {name:'oldPassword',alias:'原密码',type:'password',validator:['required']},
            {name:'newPassword',alias:'新密码',type:'password',validator:['required']},
            {name:'confirmNewPassword',alias:'确认密码',type:'password',validator:['required']}
        ];
        this.preSave = function () {
            if(scope.newPassword() != scope.confirmNewPassword()){
                Util.showAlert({data:{success:false,message:'新密码与确认密码不符'}});

                return false;
            }

            return true;
        };
        this.form = 'PasswordForm';
        this.callParent(params);
    }

    Password.extend(MAjax);

    return Password;
});
